

import java.io.Serializable;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import com.taoban.dao.HiberOperations;
import com.taoban.dao.mongodb.MongoDb;
import com.taoban.dao.mongodb.MongoDbOps;
import com.taoban.model.sp.CatalogMapping;
import com.taoban.model.sp.ExternalLink;
import com.taoban.model.sp.SpCatalog;
import com.yufei.infoExtractor.pfw.entity.Catalog;
import com.yufei.pfw.service.PfwService;
import com.yufei.utils.SpringUtils;

public class DataTransfer {

	/**
	 * @param args
	 */
	public static void main(String[] args) {
		// TODO Auto-generated method stub
    /* PfwService pfwService=(PfwService) SpringUtils.getBeanFromBeanContainer(PfwService.class, "conf/app.xml");
 	 HiberOperations ho=new MongoDbOps();
 	 Map map=null;
 	List<Catalog> catalogs=pfwService.query(map, Catalog.class);
 	for(Catalog  catalog:catalogs){
 		SpCatalog spCatalog=new SpCatalog();
 		spCatalog.setId(MongoDb.getInstance().getLongAutoId(SpCatalog.class));
 		spCatalog.setName(catalog.getName());
 		spCatalog.setParentCategoryId(0);
 		ho.save(spCatalog);
 		
 	}
 	List<com.yufei.infoExtractor.pfw.entity.ExternalLink> externalLinks2=pfwService.query(map, com.yufei.infoExtractor.pfw.entity.ExternalLink.class);
    for(com.yufei.infoExtractor.pfw.entity.ExternalLink externalLink:externalLinks2){
    	ExternalLink externalLink0=new ExternalLink();
    	externalLink0.setId(MongoDb.getInstance().getLongAutoId(ExternalLink.class));
    	externalLink0.setLink(externalLink.getLink());
    	ho.save(externalLink0);
    	
    }
    List<com.yufei.infoExtractor.pfw.entity.CatalogMapping> catalogMappings=pfwService.query(map, com.yufei.infoExtractor.pfw.entity.CatalogMapping.class);
	for(com.yufei.infoExtractor.pfw.entity.CatalogMapping catalogMapping:catalogMappings){
		CatalogMapping catalogMapping2=new CatalogMapping();
		catalogMapping2.setId(MongoDb.getInstance().getLongAutoId(CatalogMapping.class));
		catalogMapping2.setCatalogId(catalogMapping.getCatalogId());
		Map map1=new HashMap();
		map1.put("name", catalogMapping.getKeyWords());
		Serializable id=ho.find(SpCatalog.class, "name", catalogMapping.getKeyWords()).get(0);
		SpCatalog spCatalog=ho.find(SpCatalog.class, id);
		catalogMapping2.setSpCatalogId(spCatalog.getId());
		ho.save(catalogMapping2);
	}*/
	}

}
